swirl README a texture generator program for texture maps Swirl is a program that repeatedly modifies images in a regular way, and often generates interesting patterns. See swirl.doc for details of execution. artshow is a demo program that invokes specific interesting textures. I was trying to find some simple algorithms that generate interesting patterns that could possibly be used as textures for texture maps, etc. All of the patterns produced wrap from top to bottom, and left to right. Swirl works as follows: For each pixel (i, j) I keep 5 values -- the R, G, and B components, and two floats, dx(i, j) and dy(i, j). Typically, the floats are small (on the order of -15 to 15). Generation n+1 is calculated from generation n as follows: At the pixel (i, j), find dx = dx(i, j) and dy = dy(i, j). Find the color (in generation n) of pixel (i+dx, j+dy). Since dx and dy are, in general, floats, do the appropriate filtering. (If you go off the image, just wrap to the opposite side.) Assign this new color to the pixel (i, j) in generation n+1. Basically, the dx and dy values form a 2-D vector field that indicate the flow direction (actually the negative of that). If the dx and dy are sinusoidal, you'll get swirling. You can also do shearing, electric attractive and repulsive fields, etc. Suggestions welcome; bugs to /dev/null. The code may change, but I'll add features using higher numbers for starting values and dx and dy specifications. -- Tom Davis (davis@sgi.com)
Source
Documentation
Reference